package  
{
	import flash.display.BitmapData;
	import flash.display.Graphics;
	import flash.display.Shape;
	import flash.events.KeyboardEvent;
	import flash.geom.Matrix;
	import framework.Pad;
	import framework.PadManager;
	import framework.State;
	import flash.text.TextField;
	
	import joystick.JoystickState;
	/**
	 * ...
	 * @author omega
	 */
	public class TitleState extends State
	{
		
		private var x:Array = new Array(100,200);
		private var y:Array = new Array(200,250);
		
		public function TitleState() 
		{
		}
		
		public override function update(bg:BitmapData):void {
			var s:Shape = new Shape();
			s.graphics.beginFill(0xffffff);
			s.graphics.drawRect(0, 0, bg.width,bg.height);
			s.graphics.endFill();
			bg.draw(s);
			
			var pm:PadManager = PadManager.getInstance();
			for (var i:uint = 0; i < 2;i++) {
				var p:Pad = pm.getPad(i);
				var t:TextField = new TextField();
				t.text = "GameTitle Player" + i;
				t.autoSize = "left";
				if (p.isPress(0)) t.text = "PRESS";
				if (p.isPush(0)) t.text = "PUSH";
				x[i] += p.getX()*5;
				y[i] += p.getY() * 5;
				var m:Matrix = new Matrix();
				m.translate(x[i], y[i]);
				bg.draw(t, m);
			}
		}
	}
}